package cn.yunhe.action;

import cn.yunhe.entity.House;
import cn.yunhe.service.UserService;
import com.opensymphony.xwork2.ModelDriven;

public class addHouseAction extends BaseAction implements ModelDriven<Object> {
    private House house;
    public  String execute(){
        UserService userService = new UserService();
        Integer user1 =(Integer)getSession().getAttribute("user1");
        System.out.println(user1);
        house.setUserid(user1);
        int flag = userService.addHouse(house);
        System.out.println(flag);
        if(flag==1){
            return SUCCESS;
        }else{
            return INPUT;
        }

    }

    public House getHouse() {
        return house;
    }

    public void setHouse(House house) {
        this.house = house;
    }



    @Override
    public Object getModel() {
        if(house==null){
            house = new House();
        }
        return  house;
    }
}
